Skip to content
This repository was archived by the owner on Nov 28, 2023. It is now read-only.

Pass a0..a2 to main()#95

Merged
bors[bot] merged 1 commit into
masterfrom
preserve-arguments
Jun 29, 2022
Merged

Pass a0..a2 to main()#95
bors[bot] merged 1 commit into
masterfrom
preserve-arguments

Conversation

@Disasm

@Disasm Disasm commented Jun 25, 2022

Copy link
Copy Markdown
Member

This PR delivers arguments stored in a0..a2 to main.

Fixes #92

Tested with:

  • build the empty example for riscv64imac-unknown-none-elf with a memory file which puts everything to 0x80000000
  • run qemu-system-riscv64 -nographic -machine virt -bios target/riscv64imac-unknown-none-elf/release/examples/empty -s -S
  • connect to qemu with gdb (target remote :1234)
  • set breakpoint to main (b main)
  • resume execution (continue)
  • inspect registers (info registers)
a0             0x0	0
a1             0x87000000	2264924160
a2             0x1028	4136
  • check header (x/xw 0x87000000)
0x87000000:	0xedfe0dd0

@Disasm Disasm force-pushed the preserve-arguments branch from a3f21d9 to 72c33a7 Compare June 25, 2022 09:46
@Disasm Disasm marked this pull request as ready for review June 25, 2022 09:46
@Disasm Disasm requested a review from a team as a code owner June 25, 2022 09:46
@SimonSapin

SimonSapin commented Jun 29, 2022

Copy link
Copy Markdown
Contributor

I’ve tested this in https://github.com/SimonSapin/riscv-qemu-demo, passing the second argument of main to Fdt::from_ptr works. Looks good to me.

@almindor almindor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@almindor

Copy link
Copy Markdown
Contributor

bors r+

@bors

bors Bot commented Jun 29, 2022

Copy link
Copy Markdown
Contributor

Build succeeded:

@bors bors Bot merged commit f324431 into master Jun 29, 2022
@bors bors Bot deleted the preserve-arguments branch June 29, 2022 22:12
@almindor

Copy link
Copy Markdown
Contributor

@Disasm @SimonSapin I forgot, we should add a CHANGELOG entry for this. Could any of you please make a PR for that?

@Disasm

Disasm commented Jun 30, 2022

Copy link
Copy Markdown
Member Author

@almindor indeed, thank you! I created #96 to fix this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accessing parameters passed in register by the previous boot stage

3 participants